//
//  WDMineViewCell.m
//  wd-serviceapp
//
//  Created by Bin Tang on 2024/8/16.
//

#import "WDMineViewCell.h"

@interface WDMineViewCell ()

@property (nonatomic, strong) TYZCommonCellModel *model;

@property (nonatomic, strong) UIImageView *icImgView;

@property (nonatomic, strong) UIImageView *thanImgView;

@property (nonatomic, strong) UILabel *titleLabel;

@end

@implementation WDMineViewCell

- (void)initWithSubViewCell {
    self.contentView.backgroundColor = [UIColor whiteColor];
    
    
}


- (void)initWithIcImgView {
    if (!_icImgView) {
        CGRect frame = CGRectMake(28, (kWDMineViewCellHeight - 24) * 0.5, 24, 24);
        _icImgView = [[UIImageView alloc] initWithFrame:frame];
        [self.contentView addSubview:_icImgView];
    }
    if (self.model) {
        _icImgView.image = [UIImage imageNamed:self.model.iconImgName];
    }
}

- (void)initWithThanImgView {
    if (!_thanImgView) {
        CGRect frame = CGRectMake(kScreenW - 20 - 8, (kWDMineViewCellHeight - 14) * 0.5, 8, 14);
        _thanImgView = [[UIImageView alloc] initWithFrame:frame];
        _thanImgView.image = [UIImage imageNamed:@"ic-mine-than"];
        [self.contentView addSubview:_thanImgView];
    }
}

- (void)initWithTitleLabel {
    if (!_titleLabel) {
        CGRect frame = CGRectMake(self.icImgView.right + 8, (kWDMineViewCellHeight - 20) * 0.5, (kScreenW - 40) * 0.5, 20);
        _titleLabel = [UILabel createWithLabel:self.contentView frame:frame font:[UIFont systemFontOfSize:14 weight:UIFontWeightRegular] propertiesBlock:^(UILabel * _Nonnull label) {
            label.textColor = [UIColor colorWithHexString:@"#000000"];
        }];
    }
    if (self.model) {
        self.titleLabel.text = objectNull(self.model.title);
    }
}

- (void)updateCellData:(id)cellEntity {
    self.model = cellEntity;
    
    [self initWithIcImgView];
    
    [self initWithThanImgView];
    
    [self initWithTitleLabel];
    
}

@end
